import pickle as pkl

f = open('data.pkl','rb+')
data = pkl.load(f)

class hard:
    def __init__(self, hardList):
        self.hardList = hardList

    def __hash__(self):
        ret = ''
        for i in self.hardList:
            ret += str(int(i*100))
        return int(ret)

    def __eq__(self, other):
        for i in range(len(other.hardList)):
            if other.hardList[i] != self.hardList[i]:
                return False
        return True

hardToSoft = {}

print('dataNum', len(data))
for hardList, softList in data:
    hardObj = hard(hardList)
    if hardObj not in hardToSoft.keys():
        hardToSoft[hardObj] = set()

    softObj = hard(softList)
    hardToSoft[hardObj].add(softObj)

print('hardNum', len(hardToSoft))
hardToSoftNums = []
softNum = 0
for hardObj, softCollection in hardToSoft.items():
    print(hardObj.hardList)
    print(len(softCollection))
    softNum += len(softCollection)
    hardToSoftNums.append(len(softCollection))

print('hard value num:', hardToSoftNums)
print('soft num:', softNum)
